{% extends "base.html" %}
{% block header %}
<script type="text/javascript" src="/static/js/jquery.treeview.js"></script>
<script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$(".tabs > ul").tabs();
    $("#browser").treeview({
        collapsed:true,
        persist: "cookie",
		toggle: function() {
			console.log("%s was toggled.", $(this).find(">span").text());
		}
	});
});
$(document).ready(function(){
	$("#f").hide();
	$("#search").click(function(){
		$("#f").show();
	});
	$("#shouqi").click(function(){
		$("#f").hide();
	});
});
</script>

{% endblock %}

{% block menu %}
   {% include 'report-menu.html' %}
{% endblock %}

{% block aside %}
<div class='left-col'>
{% autoescape off %}
    {{ tree }}
{% endautoescape %}
</div>
{% endblock %}

{% block content %}
<div id="mon-tit">
	<div class="left">暴风服务报表 >> 所有监控报表</div>
	<div class="right"><a href="./addreport">创建报表</a></div>
</div>
<div class="clr">
</div>
	<hr>
	<h3 class='tit'>报表列表 <span><a align="right" href="javascript:" class="open" id="search">展开</a></span></h3>
        <div id="f">
		<form method="post" action="/report/search/">
			报表名：<input type="text" name="rname" size="6">
			<input type="submit" value="查询">&nbsp;&nbsp;

			订阅人：
				<select name="uid" >
				<option value ="">- -</option>
				{% for l in user %}
				<option value = "{{l.user_id}}">-{{ l.user }}-</option>
				{% endfor %}
				</select>
			<input type="submit" value="查询">&nbsp;&nbsp;
			<a href="/report/search?a=me">我的订阅</a>&nbsp;&nbsp;
			<input type="button" style="float:right" value="收起" id="shouqi">
		</form>
        </div>
	<div id="mon-dis" class="right-col">
	    <div class="title">
	    <!--
			<span style="width:10%">选择</span>
		-->
			<span style="width:30%">报表名称</span>
			<span style="width:25%">数据来源</span>
			<span style="width:10%">发送周期</span>
			<span style="width:15%">订阅人</span>
			<span style="width:20%">操作</span>
		</div>
	{% if messages %}
		{% for message in messages %}
			{% if message == "modifysuccess" %}
				<script language=javascript>alert('修改报表信息成功!!');window.location.href='/report';</script>
			{% endif %}
		{% endfor %}
	{% endif %}
		{% for l in lst %}
		<div class="{% cycle 'ji' 'ou' %}">
		<!--
            <span style="width:10%"><input type="checkbox" />{{ forloop.counter }}</span>
        -->
            <span style="width:30%">{{ l.rname }}</span>
            <span style="width:25%">{{ l.source }}</span>
            <span style="width:10%">&nbsp;&nbsp;{{ l.freq }}&nbsp;&nbsp;</span>
            <span style="width:15%">{{ l.user }}&nbsp;&nbsp;</span>
            <span style="width:20%">
            <a href="/report/pausereport/{{ l.id }}" onclick="if(confirm('确定暂停报表么？')){}else{return false;};">暂停</a>|
            <a href="/report/modifyreport/{{ l.id }}" >修改</a>|
            <a href="/report/deletereport/{{ l.id }}" onclick="if(confirm('确定删除么？')){}else{return false;};">删除</a>|
			<a href="/monitor/monitorview/{{ l.mid.id }}">详情</a></span>
         </div>
		{% endfor %}
	</div>
        <div class='clr'></div>
        <div class='page'>
		{% for p in page_lst %}
            {% if p == page %}
            <a class='on' href='/report?page={{p}}'>{{p}}</a>
            {%else%}
            <a href='/report?page={{p}}'>{{p}}</a>
            {% endif %}
        {% endfor %}    

        </div>

{% endblock %}
